﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

/// <summary>
/// Summary description for Strings
/// </summary>
namespace Util
{
    public class Strings
    {
        public static string MesAbreviado(int idMes)
        {
            string[] meses = { "Jan",
                           "Fev",
                           "Mar",
                           "Abr",
                           "Mai",
                           "Jun",
                           "Jul",
                           "Ago",
                           "Set",
                           "Out",
                           "Nov",
                           "Dez"
                         };

            return meses[idMes-1];
        }

        public static string FormatarData(DateTime sData)
        {
            string dataFormatada;
            string dia;
            string mes;

            dia = sData.Day.ToString();
            mes = sData.Month.ToString();

            if (dia.Length == 1)
                dia = "0" + dia;

            if (mes.Length == 1)
                mes = "0" + mes;

            dataFormatada = dia + "/" + mes + "/" + sData.Year;

            return dataFormatada;
        }

        public static string FormatarData(string sData)
        {
            string[] aData = sData.Split(new char[] { '/' });
            string dataFormatada;

            dataFormatada = aData[2] + "/" + aData[1] + "/" + aData[0];

            return dataFormatada;
        }
    }    
}
